<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>时间轴</title>
	<link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <link href="../static/css/main/animate.min.css" th:href="@{/css/main/animate.min.css}" rel="stylesheet"/>
    <link th:href="@{/css/style.css}" rel="stylesheet"/>
</head>
<body class="gray-bg">
<div th:if="${#lists.isEmpty(todoItemList)}" style="text-align: center; height: 500px; line-height: 500px;">暂无任务</div>
<div th:unless="${#lists.isEmpty(todoItemList)}" class="row animated fadeInRight">
        <div class="ibox float-e-margins">
            <div id="ibox-content">
                <div id="vertical-timeline" class="vertical-container light-timeline">
                     <div th:each="todoItem: ${todoItemList}" class="vertical-timeline-block">
                         <div class="vertical-timeline-icon navy-bg">
                             <i class="fa fa-file-text"></i>
                         </div>
                         <div class="vertical-timeline-content">
                             <h2>【[[${ todoItem.nodeName }]]】[[${ todoItem.itemName }]]</h2>
                             <p>[[${ todoItem.itemContent }]]
                             </p>
                             <a href="javascript:void(0)" class="btn btn-sm btn-primary" th:onclick="showVerifyDialog([[${todoItem.taskId}]], [[${todoItem.module}]], [[${todoItem.taskName}]], [[${todoItem.nodeName}]])"> 办理</a>
                             <span class="vertical-date">
                         	<!--今天--><!--<span id="todoTimeSpan" th:text="${#dates.format(todoItem.todoTime, 'yyyy-MM-dd HH:mm:ss')}"></span>--> <br>
                         <small th:text="${#dates.format(todoItem.todoTime, 'yyyy-MM-dd HH:mm:ss')}"></small>
                     </span>
                         </div>
                     </div>
                 </div>
             </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script>
        var prefix = ctx + "process/todoitem";
        $(document).ready(function(){
          // transDate();
        });

        function showVerifyDialog(taskId, module, pageName, nodeName) {
            var url = prefix + "/showVerifyDialog/" + taskId + "?module=" + module + "&formPageName=" + pageName;
            $.modal.open(nodeName, url);
        }

        function transDate() {
          var $time =document.getElementById("todoTimeSpan");
          var date = $time.innerHTML.trim();
          date = new Date(date);
          var tt = date;
          var days = parseInt((new Date().getTime() - date) / 86400000);
          var today = new Date().getDate();
          var year = tt.getFullYear();
          var mouth = tt.getMonth() + 1;
          var day = tt.getDate();
          var time = tt.getHours() < 10 ? "0" + tt.getHours() : tt.getHours();
          var min = tt.getMinutes() < 10 ? "0" + tt.getMinutes() : tt.getMinutes();
          var result, offset;
          offset = Math.abs(today - day);
          if (days < 4&&offset<4) {
            if (offset === 0) {
              result = "今天" + time + ":" + min;
            } else if (offset === 1) {
              result = "昨天" + time + ":" + min;
            } else if (offset === 2) {
              result = "前天" + time + ":" + min;
            } else if (offset === 2) {
              result = "3天前" + time + ":" + min;
            }
          } else {
            // result = year + "-" + mouth + "-" + day + " " + time + ":" + min;
            result = "3天以前";
          }
          $time.innerHTML = result;
        }

    </script>
</body>
</html>
